<extend name="public@base5"/>
<block name="head">
    <style>
        .c_1 {
            color: #009022;
        }
    </style>
</block>
<block name="main">
    <div class="wrap js-check-wrap">
        <ul class="nav nav-tabs">
            <li class="nav-item">
                <a class="nav-link active" href="{:url('Task/medal_list')}">勋章列表</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="{:url('Task/add_medal')}">添加勋章</a>
            </li>

        </ul>
        
        <table class="table table-hover table-bordered margin-top-20">
            <thead>
            <tr>
                <th width="50">ID</th>
                <th>勋章名称</th>
                <th>勋章类型<br/>
                    <a class="btn btn-primary btn-sm" href="{:url('medal_list',['key'=>0])}">成长勋章</a> 
        <a class="btn btn-success btn-sm" href="{:url('medal_list',['key'=>1])}">推广勋章</a>
                </th>                
                <th>勋章图标</th>
                <th>描述</th>
                <th width="120">{:lang('ACTIONS')}</th>
            </tr>
            </thead>
            <tbody>
            <?php
                $names = ['成长勋章','推广勋章'];
            ?>
            <foreach name="medals" item="vo">
                <tr>
                    <td>{$vo.id}</td>
                    <td>
                        {$vo.medal_name}
                    </td>
                    
                    <td class="c_{$vo.medal_key}">
                        {$names[$vo.medal_key]}
                    </td>
                    <td><img src="{:cmf_get_image_preview_url($vo.medal_url)}" width="120px" height="100px"/></td> 
                    <td>{$vo.medal_desc}</td> 

                    <td>
                        <a class="btn btn-xs btn-primary" href='{:url("task/add_medal",["id"=>$vo["id"]])}'
                           title="{:lang('EDIT')}" data-toggle="tooltip">
                            <i class="fa fa-edit fa-fw"></i>
                        </a>
                        <a class="btn btn-xs btn-danger js-ajax-delete"
                           href="javascript:"
                           data-href="admin/task/del_medal/id/{$vo.id}" title="{:lang('DELETE')}" data-toggle="tooltip">
                            <i class="fa fa-trash fa-fw"></i>
                        </a>
                    </td>
                </tr>
            </foreach>
            </tbody>
        </table>
    </div>
</block>
